document.writeln("<script type=\"text\/javascript\" src=\"lib\/jquery\/jquery.ui.core.js\"><\/script>");
document.writeln("<script type=\"text\/javascript\" src=\"lib\/jquery\/jquery.ui.draggable.js\"><\/script>");
document.writeln("<script type=\"text\/javascript\" src=\"lib\/jquery\/jquery.ui.dialog.js\"><\/script>");
document.writeln("<script type=\"text\/javascript\" src=\"lib\/jquery\/jquery.bgiframe.js\"><\/script>");
document.writeln("<script type=\"text\/javascript\" src=\"lib\/jquery\/jquery.bw.roll.js\"><\/script>");
document.writeln("<script type=\"text\/javascript\" src=\"lib\/jquery\/jquery.bw.check.js\"><\/script>");

$(document).ready(function(){
    //
    $("#affiche").bwroll({line:1,space:3000});
    //
    $("#check_on").bwcheck({find:"input[handle='topic']",value:'on'});
    $("#check_off").bwcheck({find:"input[handle='topic']",value:'off'});
    $("#check_toggle").bwcheck({find:"input[handle='topic']",value:'toggle'});
    // del
    $("#topic_del_confirm").dialog({
        bgiframe: true,
        autoOpen: false,
        width: 300,
        height: 160,
        modal: true,
        overlay: {
            backgroundColor: '#000000',
            opacity: 0.5
        },
        buttons: {
            '取消': function() {
                $(this).dialog('close');
            },
            '删除': function() {
                $('#bw_form_topic_list').attr("action",$("#topic_del_action").val());
                $('#bw_form_topic_list').submit();
            }
        }
    });
    $('#topic_del_button').click(function() {
        $('#topic_del_confirm').dialog('open');
    });
    // move
    $("#topic_move_confirm").dialog({
        bgiframe: true,
        autoOpen: false,
        width: 300,
        height: 200,
        modal: true,
        overlay: {
            backgroundColor: '#000000',
            opacity: 0.5
        },
        buttons: {
            '取消': function() {
                $(this).dialog('close');
            },
            '移动': function() {
                if ($("#channel_tree_move").val() <= 0) {
                    $('#topic_move_confirm_warn').show();
                } else {
                    $('#bw_form_topic_list').attr("action",$("#topic_move_action").val()+"&moveto="+$("#channel_tree_move").val());
                    $('#bw_form_topic_list').submit();
                }
            }
        }
    });
    $('#topic_move_button').click(function() {
        $('#topic_move_confirm_warn').hide();
        $('#topic_move_confirm').dialog('open');
    });
    //////
});
